package guanjianzi;

public class Student extends Person{


        //Student子类继承父类Person类

    /*
     属性
     成员变量
     */

        private String stuNum;
        private  String stuScore;

        //getter的接口
        public String getStuNum() {
            return stuNum;
        }

        public String getStuScore() {
            return stuScore;
        }

        //setter的接口

        public void setStuNum(String stuNum) {
            this.stuNum = stuNum;
        }

        public void setStuScore(String stuScore) {
            this.stuScore = stuScore;
        }

        //默认构造方法
        public  Student(){
            System.out.println("——-----子类Student的默认构造方法--------");
        }

        //自定义构造方法
        public Student(String perName,int perAge,String perSex,String stuNum,String stuScore){
            super(perName,perAge,perSex);//super调用父类Person的成员变量
            System.out.println("执行了子类的构造方法");
            this.stuNum = stuNum;
            this.stuScore = stuScore;
            System.out.println("姓名："+perName+"年龄："+perAge+"性别："+perSex+"学号："+stuNum+"成绩："+stuScore);


        }
        //行为方法
        public  void  doStuding(){
            System.out.println("I am studing....................");
        }

        public  void  doEating(){
            //supper 关键字调用父类行为
            super.doEating();
            System.out.println("student is eating。。。。。。。。。。。。。。。");
        }

    }


